package com.pepsico.introjava.labs;
import static org.junit.Assert.*;
import org.junit.Test;

import com.pepsico.introjava.exceptions.InvalidParameterException;
import com.pepsico.introjava.exceptions.InvalidRangeException;
import com.pepsico.introjava.labs.Employee;


public class EmployeeTest
{
	@Test
	public void testNewEmployee()
	{
		Employee e = new Employee();
		assertEquals ("Fred", e.getName());
		assertEquals (50.0, e.getSalary(), .01);
	}

	@Test
	public void testEmployeePay()
	{
		Employee e = new Employee("Chuck", 100);
		float net = e.pay();
		assertEquals (92.35, net, .001);
		assertEquals (100.0, e.getYtdSalary(), .01);
		assertEquals (7.65, e.getYtdTax(), .01);
	}
	
	@Test (expected=InvalidParameterException.class)
	public void testInvalidName()
	{
		new Employee("Chuck#Invalid");
	}
	
	@Test (expected=InvalidRangeException.class)
	public void testInvalidSalary()
	{
		new Employee ("Chuck", 5);
	}

}














